package com.auxgroup.smarthome.repo;

import com.auxgroup.smarthome.entity.RoleEntity;
import com.auxgroup.smarthome.entity.UserEntity;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * Created by kevinchen on 2016/12/20.
 */
public interface UserRepo extends GenericDao<UserEntity,String> {

    UserEntity findByUserName(String userName);

    UserEntity findByEmail(String email);

    UserEntity findByPhone(String phone);

    UserEntity findByRole(RoleEntity roleEntity);

    @Query(value = "select id from sys_user where role_id = ?",nativeQuery = true)
    List<String> findUserIdListBySql(String roleId);

}
